home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NetNews Offline 2
/
NetNews Offline Volume 2.iso
/
news
/
comp
/
std
/
c
/
12
< prev
next >
Wrap
Internet Message Format
|
1996-08-06
|
2KB
Path: rz.uni-karlsruhe.de!not-for-mail
From: ig25@fg70.rz.uni-karlsruhe.de (Thomas Koenig)
Newsgroups: comp.std.c
Subject: Re: Alignment of malloc()
Date: 2 Jan 1996 23:25:47 +0100
Organization: =?ISO-8859-1?Q?Universit=E4t_Karlsruhe_(TH),_Germany_?=
Message-ID: <4ccbdb$5v6@fg70.rz.uni-karlsruhe.de>
References: <DKDA7D.Kw7@midway.uchicago.edu> <j66Sx*FRe@yaps.rhein.de> <DKKHCH.L6r@midway.uchicago.edu>
Reply-To: ig25@mvmap66.ciw.uni-karlsruhe.de
NNTP-Posting-Host: fg70.rz.uni-karlsruhe.de
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
NNTP-Posting-User: ig25
In comp.std.c, Michael Spertus<mps@geodesic.com> wrote:
>My question is what the committee means by the words "proper alignment". If
>"proper" COMPLETELY ignores efficiency consideration even if they are
>gross, it means that I would have to align all malloc() returns according to
>the size of the data in all portable code I write.
This is a quality of implementation issue. In other words, somebody
could write a losing compiler/standard library which generated pessimal
code when malloc() is used with certain data types. A compiler writer
is also allowed to have the compiler put a loop eating up 100 seconds of
CPU time each time an assignment is made. Neither would tend to sell
many compilers; neither is likely to be implemented.
>However, I've never seen
>an "ANSI C" textbook that advises aligning malloc() returns by hand.
I know of no compiler which is as brain-damaged as the one you describe;
when I encounter one, I'd tend to howl to the vendor.
--
Thomas Koenig, Thomas.Koenig@ciw.uni-karlsruhe.de, ig25@dkauni2.bitnet.
The joy of engineering is to find a straight line on a double
logarithmic diagram.